import openpyxl
from openpyxl.utils import get_column_letter, column_index_from_string

wb = openpyxl.load_workbook('example.xlsx')
sheets = wb.sheetnames
print(sheets)

sheet2 = wb["Sheet2"]
print(sheet2)
# column_letter = get_column_letter(1)
# column_1 = sheet1[column_letter]
# for cell in column_1:
#     print(cell.value)

# wb.remove(wb["Sheet3"])
# sheets = wb.sheetnames
# print(sheets)
# wb.save("example1.xlsx")

# wb.create_sheet("test", index=0)
# sheets = wb.sheetnames
# print(sheets)
# sheet2 = wb['test']
# sheet2['A1'] = 'HELLO,WORLD'
# wb.save('example2.xlsx')

# sheet2['A5'] = '=SUM(A1:A4)'
# wb.save("example.xlsx")

# cell_with_formula = sheet2['A5']
# print(cell_with_formula.value)
# print(cell_with_formula.internal_value)

# sheet2['B2'] = 'Width column'
# sheet2.row_dimensions[2].height = 70
# sheet2.column_dimensions['B'].width = 30

# sheet2.merge_cells('A1:C2')
# # sheet2.merge_cells(start_row=1, start_column=1, end_row=2, end_column=2)
# sheet2['A1'] = 'Meged cells '
# sheet2.unmerge_cells('A1:B2')
sheet2.freeze_panes = 'B2'
wb.save('example.xlsx')
wb.close()
